import http from '../utils/request'
const AuthAPI = {
	/**
	 * 登录
	 */
	Login: (data) => {
		return http.request({
			url: `/blade-auth/token?grantType=password&account=${data.account}&password=${data.password}&tenantId=${data.tenantId}`,
			method: 'POST',
			data
		})
	},
	/**
	 * 退出
	 */
	Logout: (data) => {
		return http.request({
			url: `/blade-auth/logout`,
			method: 'POST',
			data
		})
	},
	/**
	 * 用户详情
	 */
	userInfo: (data) => {
		return http.request({
			url: `/blade-system/user/info`,
			method: 'GET',
			data
		})
	},

	/**
	 *  修改用户信息 
	 */
	userUpdate: (data) => {
		return http.request({
			url: `/blade-system/user/update`,
			method: 'POST',
			data
		})
	},
	/**
	 * 修改用户信息 
	 */
	updatePassword: (data) => {
		return http.request({
			// ?oldPassword=1&newPassword=1&newPassword1=1
			url: `/blade-system/user/update-password?oldPassword=${data.oldPassword}&newPassword=${data.newPassword}&newPassword1=${data.newPassword1}`,
			method: 'POST',
			data
		})
	},

	/**
	 * 修改用户头像 
	 */
	updateAvatar: (path) => {
		return http.uploadFile(path)
	},
}
export default AuthAPI